$(function() {

    $('#newaccountform').dialog({
        autoOpen: false,
        height: 400,
        width: 550,
        modal: true,
        buttons: {
            'Create Account': function() {
                var queryString = $('#groupcreatedialog').serialize();
                $.post(contextPath + '/accnt/groupcreate', queryString, function(data) {
                    var newAccntLink = '<li style="padding: 2px; 0"><a href="/keelernadler/accnt/show/' + data.id + '">' + data.name + '</a><a style="float:right;" href="/keelernadler/accnt/deleteLink/' + data.id + '?grpId='+data.groupAccount.id+ '">delete </a></li>';
                    $('#account_list').append(newAccntLink);
                }, 'json');
                $(this).dialog('close');
            },
            Cancel: function() {
                $(this).dialog('close');
            }

        },
        close: function() {

        }
    });

    $('#add_account').click(function() {
        $('#newaccountform').dialog('open');
    });

});